CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
SET(PROJECT_NAME "EEditor2" CACHE string "denominate the solution")
PROJECT(${PROJECT_NAME})

#SET(CMAKE_BUILD_TYPE, RELEASE)
# IF (UNIX)
    # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# ENDIF()


#SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
#SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
#SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows")
#SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows")
#IF (CMAKE_BUILD_TYPE MATCHES "Release")
#    SET(CMAKE_BUILD_POSTFIX "${CMAKE_RELEASE_POSTFIX}")
#ELSEIF (CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
#    SET(CMAKE_BUILD_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}")
#ELSEIF(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
#    SET(CMAKE_BUILD_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}")
#ELSEIF(CMAKE_BUILD_TYPE MATCHES "Debug")
#    SET(CMAKE_BUILD_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
#ELSE()
#    SET(CMAKE_BUILD_POSTFIX "")
#ENDIF()

IF (UNIX)
    SET(DEPEND_BUILD_TYPE "install_gcc")#"install_vs2019_x64"
ELSEIF(WIN32)
    SET(DEPEND_BUILD_TYPE "install_vs2019_x64")#"install_vs2019_x64"
ELSE()
    SET(DEPEND_BUILD_TYPE "install_vs2019_x64")#"install_vs2019_x64"
ENDIF()

SET(DEPEND_DIR "${PROJECT_SOURCE_DIR}/../Depend" CACHE PATH "Path of Depend-hub")
# set(MY_VARIABLE "InitialValue" CACHE STRING "Description of MY_VARIABLE")
IF (WIN32 OR UNIX)

    SET(COIN3D_DIR ${DEPEND_DIR}/coin3d/Coin-4.0.0/${DEPEND_BUILD_TYPE})
    SET(COIN3D_BIN_DIR ${COIN3D_DIR}/bin)

    SET(OSG_3RD_PARTY_DIR ${DEPEND_DIR}/osg-3rdparty/${DEPEND_BUILD_TYPE})
    SET(OSG_3RD_PARTY_BIN_DIR ${OSG_3RD_PARTY_DIR}/bin)

    SET(OSG_DIR ${DEPEND_DIR}/osg/osg-3.7.0/${DEPEND_BUILD_TYPE})
    SET(OSG_INCLUDE_DIR ${OSG_DIR}/include)
    SET(OSG_LIB_DIR ${OSG_DIR}/lib)
    SET(OSG_BIN_DIR ${OSG_DIR}/bin)

    SET(QT_DIR ${DEPEND_DIR}/qt/qt-src-5.13.2/${DEPEND_BUILD_TYPE})
    # SET(QT_DIR "/data/data/com.termux/files/usr/")
	SET(Qt5Widgets_DIR ${QT_DIR}/lib/cmake/Qt5Widgets)
	SET(QT_INCLUDE_DIR ${QT_DIR}/include)
	SET(QT_LIB_DIR ${QT_DIR}/lib)
	SET(QT_BIN_DIR ${QT_DIR}/bin)

    SET(QT_TABTOOLBAR_DIR ${DEPEND_DIR}/qtTabToolbar/qtTabToolbar-src/${DEPEND_BUILD_TYPE})
    SET(QT_TABTOOLBAR_INCLUDE_DIR ${QT_TABTOOLBAR_DIR}/include)
    SET(QT_TABTOOLBAR_LIB_DIR ${QT_TABTOOLBAR_DIR}/lib)
    SET(QT_TABTOOLBAR_BIN_DIR ${QT_TABTOOLBAR_DIR}/bin)

    SET(QUAZIP_DIR ${DEPEND_DIR}/quazip/quazip-master/${DEPEND_BUILD_TYPE})
    SET(QUAZIP_INCLUDE_DIR ${QUAZIP_DIR}/include)
    SET(QUAZIP_LIB_DIR ${QUAZIP_DIR}/lib)
    SET(QUAZIP_BIN_DIR ${QUAZIP_DIR}/bin)

    SET(ZLIB_DIR ${DEPEND_DIR}/osg-3rdparty/${DEPEND_BUILD_TYPE})
    SET(ZLIB_INCLUDE_DIR ${ZLIB_DIR}/include)
    SET(ZLIB_LIB_DIR ${ZLIB_DIR}/lib)
    SET(ZLIB_BIN_DIR ${ZLIB_DIR}/bin)

    SET(UE_DIR ${PROJECT_SOURCE_DIR}/../Depend/ue/ue5-src/)
    SET(UE_SOURCE_DIR ${UE_DIR}/Engine/Source/)
    SET(UE_INTERMEDIATE_DIR ${UE_DIR}/Engine/Intermediate/)

    SET(RTTR_DIR ${DEPEND_DIR}/rttr/rttr-master/${DEPEND_BUILD_TYPE})
    SET(RTTR_INCLUDE_DIR ${RTTR_DIR}/include)
    SET(RTTR_LIB_DIR ${RTTR_DIR}/lib)
    SET(RTTR_BIN_DIR ${RTTR_DIR}/bin)

    # SET(CLANG_DIR "/data/data/com.termux/files/usr/")
    SET(CLANG_DIR ${DEPEND_DIR}/llvm/llvm-4.0.5-installed/${DEPEND_BUILD_TYPE})
    SET(CLANG_INCLUDE_DIR ${CLANG_DIR}/include)
    SET(CLANG_LIB_DIR ${CLANG_DIR}/lib)
    SET(CLANG_BIN_DIR ${CLANG_DIR}/bin)

    SET(GLM_DIR ${DEPEND_DIR}/glm/glm_src_0.9.9/${DEPEND_BUILD_TYPE})
    SET(GLM_INCLUDE_DIR ${GLM_DIR})

    SET(LEAP_SDK_DIR ${DEPEND_DIR}/leapMotion/LeapSDK/)
    SET(LEAP_SDK_INCLUDE_DIR ${LEAP_SDK_DIR}/include)
    SET(LEAP_SDK_LIB_DIR ${LEAP_SDK_DIR}/lib/x64)
    SET(LEAP_SDK_BIN_DIR ${LEAP_SDK_DIR}/lib/x64)

    # SET(VTK_DIR ${DEPEND_DIR}/vtk/VTK-9.2.2/${DEPEND_BUILD_TYPE})
    # SET(VTK_INCLUDE_DIR ${VTK_DIR}/include/vtk-9.2)
    SET(VTK_DIR ${DEPEND_DIR}/vtk/VTK-9.1.0/${DEPEND_BUILD_TYPE})
    SET(VTK_INCLUDE_DIR ${VTK_DIR}/include/vtk-9.1)
    SET(VTK_LIB_DIR ${VTK_DIR}/lib)
    SET(VTK_BIN_DIR ${VTK_DIR}/bin)

    SET(PCL_DIR ${DEPEND_DIR}/pcl/pcl-1.13.0/${DEPEND_BUILD_TYPE})
    SET(PCL_INCLUDE_DIR ${PCL_DIR}/include/pcl-1.13)
    SET(PCL_LIB_DIR ${PCL_DIR}/lib)
    SET(PCL_BIN_DIR ${PCL_DIR}/bin)

    SET(BOOST_DIR ${DEPEND_DIR}/boost/boost_1_82_0/${DEPEND_BUILD_TYPE})
    SET(BOOST_INCLUDE_DIR ${BOOST_DIR}/include/boost-1_82)
    SET(BOOST_LIB_DIR ${BOOST_DIR}/lib)
    
    SET(EIGEN_DIR ${DEPEND_DIR}/eigen/eigen-3.4.0/${DEPEND_BUILD_TYPE})
    SET(EIGEN_INCLUDE_DIR ${EIGEN_DIR}/include/eigen3)
    SET(EIGEN_LIB_DIR ${EIGEN_DIR}/lib)
    #for occ 7.0
    # SET(OCC_DIR ${PROJECT_SOURCE_DIR}/../Depend/occ/occ_7.0/${DEPEND_BUILD_TYPE})
    # SET(OCC_INCLUDE_DIR ${OCC_DIR}/include)
    # SET(OCC_LIB_DIR ${OCC_DIR}/lib)
    # SET(OCC_BIN_DIR ${OCC_DIR}/bin)
    #for occ 7.7
    SET(OCC_DIR ${DEPEND_DIR}/occ/occ-7_7_0/${DEPEND_BUILD_TYPE})
    SET(OCC_INCLUDE_DIR ${OCC_DIR}/include)
    SET(OCC_LIB_DIR ${OCC_DIR}/libd)
    SET(OCC_BIN_DIR ${OCC_DIR}/bind)

    SET(TINYXML2_DIR ${DEPEND_DIR}/tinyxml2/tinyxml2-master/${DEPEND_BUILD_TYPE})
    SET(TINYXML2_INCLUDE_DIR ${TINYXML2_DIR}/include)
    SET(TINYXML2_LIB_DIR ${TINYXML2_DIR}/lib)

    SET(EMSDK_INCLUDE_DIR ${DEPEND_DIR}/emsdk/emsdk-3.1.34/upstream/emscripten/system/include)

    SET(ACL_DIR ${DEPEND_DIR}/acl/acl-v3.6.1-2/${DEPEND_BUILD_TYPE})
    SET(ACL_INCLUDE_DIR ${ACL_DIR}/include)
    SET(ACL_LIB_DIR ${ACL_DIR}/lib)


    SET(CMDLINE_DIR ${DEPEND_DIR}/cmdline/cmdline-master)
    SET(CMDLINE_INCLUDE_DIR ${DEPEND_DIR}/cmdline/cmdline-master)

    SET(SPDLOG_DIR ${DEPEND_DIR}/spdlog/spdlog-1.12.0/${DEPEND_BUILD_TYPE})
    SET(SPDLOG_INCLUDE_DIR ${SPDLOG_DIR}/include)
    SET(SPDLOG_LIB_DIR ${SPDLOG_DIR}/lib)
	# SET(GTEST_DIR D:/Eric/Coding/gpOsg/3rd-party/gtest/vs2015_x64)
    # SET(OSG_EARTH_DIR D:/Eric/Coding/gpOsg/3rd-party/osgEarth/osgearth-2.10.1-build_vs2015_x64-install/install)
    # SET(GLM_DIR ${PROJECT_SOURCE_DIR}/../Depend/glm/glm_src_0.9.9/)
ELSEIF (APPLE)
	#给MacOS用的
	SET(QT_INCLUDE_DIR "~/Qt5.12.8/5.12.8/clang_64/lib")
	SET(QT_LIB_DIR "~/Qt5.12.8/5.12.8/clang_64/lib")
	SET(Qt5Widgets_DIR "~/Qt5.12.8/5.12.8/clang_64/lib/cmake/Qt5Widgets")
	SET(OSG_DIR "~/Desktop/Eric/coding/3rd-party/osg/buildOsg3.6.4/build-osg-Desktop_Qt_5_12_8_clang_64bit-Release")
	SET(GTEST_DIR D:/Eric/Coding/gpOsg/3rd-party/gtest/vs2015_x64)
# ELSEIF (UNIX)
    # SET(QT_DIR ${DEPEND_DIR}/qt/qt-src-5.13.2/${DEPEND_BUILD_TYPE})
    # # SET(QT_DIR "/data/data/com.termux/files/usr/")
	# SET(Qt5Widgets_DIR ${QT_DIR}/lib/cmake/Qt5Widgets)
	# SET(QT_INCLUDE_DIR ${QT_DIR}/include)
	# SET(QT_LIB_DIR ${QT_DIR}/lib)
	# SET(QT_BIN_DIR ${QT_DIR}/bin)
ENDIF ()

#only for arm 64, ubuntu 24.0 tested
IF (UNIX AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
    SET(QT_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Widgets)
    # SET(QT_DIR "/data/data/com.termux/files/usr/")
	SET(Qt5Widgets_DIR /usr/lib/aarch64-linux-gnu/cmake/Qt5Widgets)
	SET(QT_INCLUDE_DIR /usr/include/aarch64-linux-gnu/qt5/)
	SET(QT_LIB_DIR /usr/lib/aarch64-linux-gnu)
    SET(QT_BIN_DIR ${QT_LIB_DIR})

    SET(EIGEN_DIR /usr/lib/aarch64-linux-gnu/engines-3)
    SET(EIGEN_INCLUDE_DIR /usr/include/eigen3)
    SET(EIGEN_LIB_DIR /usr/lib/aarch64-linux-gnu/engines-3)

    SET(CLANG_DIR ${DEPEND_DIR}/llvm/llvm-4.0.5-installed/${DEPEND_BUILD_TYPE})
    SET(CLANG_INCLUDE_DIR /usr/lib/llvm-18/include)
    SET(CLANG_LIB_DIR /usr/lib/llvm-18/lib)
    SET(CLANG_BIN_DIR ${CLANG_LIB_DIR})

    SET(OSG_DIR /usr/share/doc/o)
    SET(OSG_INCLUDE_DIR /usr/include/)
    SET(OSG_LIB_DIR /usr/lib/aarch64-linux-gnu)
    SET(OSG_BIN_DIR /usr/lib/aarch64-linux-gnu)

    SET(VTK_DIR ${DEPEND_DIR}/vtk/VTK-9.1.0/${DEPEND_BUILD_TYPE})
    SET(VTK_INCLUDE_DIR /usr/include/vtk-9.1)
    SET(VTK_LIB_DIR /usr/lib/aarch64-linux-gnu/)
    SET(VTK_BIN_DIR /usr/lib/aarch64-linux-gnu/)
ENDIF ()

#导出cmake的编译信息，给YCM插件使用
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(UNIX)
    set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
endif()

#在MinGW下去掉dll声明，只是为了生成nvim可以用的compile_commands文件
if("${CMAKE_C_COMPILER}" MATCHES "gcc")
    message(STATUS "Detected MinGW C compiler")
    ADD_DEFINITIONS (-DNO_DLL_STATEMENT)
endif()

# ADD_DEFINITIONS (-DUSE_QT_BASIC)
#---------------------------------
 # add_subdirectory(ExePlane)
 add_subdirectory(ExeCommon)

 add_subdirectory(LibCommon)
 # add_subdirectory(LibIk)
 add_subdirectory(LibReflection)
 add_subdirectory(LibUiQt)


 add_subdirectory(ExeReflection)

 add_subdirectory(PluginDefault/Autogen)
 add_subdirectory(PluginDefault)
 add_subdirectory(PluginXml/Autogen)
 add_subdirectory(PluginXml)
 # add_subdirectory(PluginOsg/Autogen)
 # add_subdirectory(PluginOsg)
 # add_subdirectory(PluginOcc/Autogen)
 # add_subdirectory(PluginOcc)
 add_subdirectory(ExeUiOverall)

 # add_subdirectory(PluginOcc)
 # add_subdirectory(LibOsg)
 # add_subdirectory(Lib3dXML)
 # add_subdirectory(LibUiWrapOsg)
 # add_subdirectory(LibVrep)

 #add_subdirectory(LibLeapMotion)
 #add_subdirectory(LibMachining)
 #add_subdirectory(LibUiWrapMachining)
 # add_subdirectory(LibVtk)
 # add_subdirectory(LibUiWrapVtk)
 # add_subdirectory(LibPcl)
 # add_subdirectory(LibSmv)
#---------------------------------
# add_subdirectory(ExeMachining_v_mac)
#---------------------------------

# add_subdirectory(ExeOsg)
# add_subdirectory(LibOsg)
#---------------------------------
# add_subdirectory(ExeUiVtk)
#---------------------------------
# add_subdirectory(ExeOcc)
#---------------------------------
# add_subdirectory(ExeLeapMotion)
#---------------------------------
 # add_subdirectory(ExePlane)
#---------------------------------
# add_subdirectory(ExeUiVrpn)
# add_subdirectory(ExeVrpn)
# add_subdirectory(LibVrpn)
# add_subdirectory(LibUiQt)
#---------------------------------
# WASM building
# add_subdirectory(LibRobot)
# add_subdirectory(LibCommon)
#---------------------------------
# add_subdirectory(LibBody)
# add_subdirectory(LibVrpn)
# add_subdirectory(LibCommon)
#---------------------------------

# add_subdirectory(LibReflection)
# add_subdirectory(LibVrep)
# add_subdirectory(ExeUI)
# add_subdirectory(ExeUiVtk)
# add_subdirectory(ExeMachining)
# add_subdirectory(ExeOsgWin32Window)
# add_subdirectory(ExeMachining)
# add_subdirectory(ExeVrpn)
# add_subdirectory(TestExeUI)
# add_subdirectory(Exe3dXML)
# add_subdirectory(ExeBody)
# add_subdirectory(ExeCommon)
# add_subdirectory(ExeReflection)
# add_subdirectory(ExeReflectionOsg)
# add_subdirectory(ExeUiVrpn)
# add_subdirectory(ExeUnreal)
# add_subdirectory(ExeOcc)


IF (UNIX)
 # add_subdirectory(UEPlugin)
ENDIF()
